/*
 *  $Id: WisdomBook.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Air.Spells {
    public class WisdomBook: SelfEnchantmentCard {
        public WisdomBook(): base("001_a_s_wisdom_book") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Air;
            Value = 100;
            AddManaCost(ElementType.Air, 2);
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new WisdomBookAffect();
        }

        private class WisdomBookAffect: EnchantmentAffect<WisdomBook> {
            public WisdomBookAffect() {
                Add(new Affects.ManaOutcome(ElementType.Air, 1));
            }

            public override void SetAffect() {
                base.SetAffect();
                LocalSummary.OnStartOffencePhase += DoWisdom;
                LocalSummary.OnMeditation += DoWisdom;
            }
            public override void ResetAffect() {
                base.ResetAffect();
                LocalSummary.OnStartOffencePhase -= DoWisdom;
                LocalSummary.OnMeditation -= DoWisdom;
            }

            private void DoWisdom() {
                Owner.Owner.CardToHands(false, true);
            }
        }
    }
}
